<template>
	<view>
		<u-sticky>
			<u-navbar title=" " :titleStyle="{color:'#fff'}" bgColor="#3478F5" placeholder>
				<view class="u-nav-slot" slot="left">
					<u-icon name="arrow-left" size="19" color="#3478F5"></u-icon>
				</view>
			</u-navbar>
			<view class="headbgc">
				<view class="flexleft" @click="login" v-if="!is_login">
					<image src="@/static/image/system/weidenglu.png" class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="titletext bai_text bold">未登录，点击登录</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexleft" @click="jumpurl('/pages/mine/gerenxx')" v-if="is_login">
					<image :src="userInfo.avatar_text?userInfo.avatar_text:'../../static/logo.png'"
						class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="flexcolumnbet" style="height: 100rpx;">
							<view class="titletext bai_text bold">{{userInfo.nickname}}</view>
							<view class="xiaobai" style="color: #DFDFDF;">会员等级：{{returndj(userInfo.level)}}</view>
						</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexbetween topcontent margin_top6" v-if="is_login">
					<view class="flexcolumn" @click="jumpurl('/pages/mine/wodeye?type=0')">
						<view class="titletext bai_text bold">{{userInfo.yy_score || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">应用积分</view>
					</view>
					<view class="myline ffffff"></view>
					<view class="flexcolumn" @click="jumpurl('/pages/mine/wodeye?type=1')">
						<view class="titletext bai_text bold">{{userInfo.rec_score || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">推广积分</view>
					</view>
					<view class="myline ffffff"></view>
					<view class="flexcolumn">
						<view class="titletext bai_text bold">{{userInfo.total_score || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">累计积分</view>
					</view>
				</view>
			</view>
		</u-sticky>
		<view class="mainpadding" style="padding-bottom: 100rpx;">
			<view class="ffffff radius" style="border-radius: 16rpx; padding: 40rpx 30rpx;">
				<view class="flexbetween  pdl" @click="jumpurl('/pages/mine/qiandao')">
					<view class="flexleft">
						<u-icon name="calendar" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">签到</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 pdl" @click="sijirz()">
					<view class="flexleft">
						<u-icon name="account" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">实名认证</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/mine/renshetm')">
					<view class="flexleft">
						<u-icon name="file-text" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">个人资料</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/system/system?type=5')">
					<view class="flexleft">
						<u-icon name="pushpin" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">问卷规则</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<!-- <view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/system/system?type=6')">
					<view class="flexleft">
						<u-icon name="pushpin" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">邀请规则</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/mine/tuiguangm')">
					<view class="flexleft">
						<u-icon name="grid" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">推广码</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view> -->
				<view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/mine/xiangmujl')">
					<view class="flexleft">
						<u-icon name="clock" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">项目记录</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<!-- <view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/mine/wodetg')">
					<view class="flexleft">
						<u-icon name="account" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">我的推广</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view> -->
				
				<view class="margin_top4 flexbetween" @click="jumpurl('/pages/mine/shezhi')">
					<view class="flexleft">
						<u-icon name="setting" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">设置</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
			</view>
		</view>
		<view class="posibottom xiaohui textcenter mainpadding" style="background-color: #fafafa;">版权归属：黑龙江硕银科技有限公司
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				is_login: false,
				userInfo: {},
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			}
		},
		onShareAppMessage() {
			let _this = this
			return {
				title: "趣调研",
				path: "pages/index/index?code=" + uni.getStorageSync("invite_code"),
			}
		},
		onShareTimeline: function() {
			return {
				title: "趣调研",
				path: "pages/index/index?code=" + uni.getStorageSync("invite_code"),
			}
		},
		methods: {
			returndj(val){
				if(val==1)return "V0"
				if(val==2)return "V1"
				if(val==3)return "V2"
				if(val==4)return "V3"
			},
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
					uni.setStorageSync("invite_code",res.data.invite_code)
				})
			},
			login() {
				uni.navigateTo({
					url: "/pages/login/appLogin"
				})
				// #ifdef MP-WEIXIN || H5
				uni.navigateTo({
					url: "/pages/login/appLogin",
					// url:"/pages/login/login"
				})
				// #endif
			},
			jumpurl(url) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/appLogin"
					})
					return false
				}
				uni.navigateTo({
					url
				})
			},
			sijirz() {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/appLogin"
					})
					return false
				}
				uni.navigateTo({
					url: "/pages/mine/shimingrz"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.headbgc {
		background: linear-gradient(180deg, #3478F5 0%, #5088fe 100%);
		padding: 30rpx 30rpx 40rpx;

	}

	.topcontent {
		padding: 30rpx 40rpx;
		background: rgba(255, 255, 255, 0.2);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.6);
	}

	.myline {
		width: 1rpx;
		height: 40rpx;
		background-color: rgba(255, 255, 255, 0.4);
	}

	.myicon {
		width: 38rpx;
		height: 38rpx;
		min-width: 38rpx;
	}

	.pdl {
		padding-bottom: 40rpx
	}
</style>